<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>智能医疗管理系统</title>
<meta name="renderer" content="webkit">
<script type="text/javascript" language="javascript" src="${request.contextPath}/statics/js/modules/login/jquery-1.11.3.min.js"></script>
<script type="text/javascript" language="javascript" src="${request.contextPath}/statics/js/modules/login/jquery.cookie.js"></script>
<script type="text/javascript" language="javascript" src="${request.contextPath}/statics/js/modules/login/layer/layer.js"></script>
<link href="${request.contextPath}/statics/css/bootstrap.min.css" rel="stylesheet">

<style type="text/css">
html, body { height: 100%; overflow: hidden; }
body {
    font-family: "Verdana", "Tahoma", "Lucida Grande", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
    background: url("${request.contextPath}/statics/images/login/loginbg_02.jpg") no-repeat center center fixed;
    background-size: cover;
}
.form-control{height:37px;}
.main_box{position:absolute; top:45%; left:50%; margin:-200px 0 0 -180px; padding:15px 20px; width:360px; height:400px; min-width:320px; background:#FAFAFA; background:rgba(255,255,255,0.5); box-shadow: 1px 5px 8px #888888; border-radius:6px;}
.login_msg{height:30px;}
.input-group >.input-group-addon.code{padding:0;}
#captcha_img{cursor:pointer;}
.main_box .logo img{height:35px;}
@media (min-width: 768px) {
    .main_box {margin-left:-240px; padding:15px 55px; width:480px;}
    .main_box .logo img{height:40px;}
}
.threed{
text-align: center;
height: 20px;
color: #fafafa;
letter-spacing: 0;
text-shadow: 0px 1px 0px #999, 0px 2px 0px #888, 0px 3px 0px #777, 0px 4px 0px #666, 0px 5px 0px #555, 0px 6px 0px #444, 0px 7px 0px #333, 0px 8px 7px #001135 
}

.stroke{
color: transparent;
-webkit-text-stroke: 1px black;
letter-spacing: 0.04em;
background-color: }
</style>
<script type="text/javascript">
var COOKIE_NAME = 'sys_em_username';
$(function() {
	//切换背景图片
    choose_bg();
    if ($.cookie(COOKIE_NAME)){
        $("#username").val($.cookie(COOKIE_NAME));
        $("#password").focus();
        $("#remember").prop('checked', true);
    } else {
        $("#username").focus();
    }
    
    $("#login_ok").click(function(){
        var issubmit = true;
        var i_index  = 999;
        $("#login_form").find('.form-control').each(function(i){
            if ($.trim($(this).val()).length == 0) {
                $(this).css('border', '1px #ff0000 solid');
                issubmit = false;
                if (i_index == 999)
                    i_index  = i;
            }
        });
        if (!issubmit) {
            $("#login_form").find('.form-control').eq(i_index).focus();
            return false;
        }
     
        if ($("#remember").prop('checked')) {
            $.cookie(COOKIE_NAME, $("#username").val(), { path: '/', expires: 15 });
        } else {
            $.cookie(COOKIE_NAME, null, { path: '/' });  //删除cookie
        }
        $("#login_ok").attr("disabled", true).val('登陆中..');
        
        var data = "username="+$("#username").val()+"&password="+$("#password").val()+"&captcha="+$("#captcha").val();
		$.ajax({
			type: "POST",
		    url: "sys/login",
		    data: data,
		    dataType: "json",
		    success: function(result){
				if(result.code == 0){//登录成功
					parent.location.href ='index.html';
				}else{
					displayMsg(result.msg);
					$('#login_form')[0].reset();
					$("#imgId").click();
				}
			}
		});
        
    });
});

function choose_bg() {
    var bg = Math.floor(Math.random() * 9 + 1);
    $('body').css('background-image', 'url(${request.contextPath}/statics/images/login/loginbg_0'+ bg +'.jpg)');
}

var fontCssStart='<font style="font-family:\'Microsoft Yahei\';font-size:13px">';
var fontCssEnd='</font>';
function displayMsg(msg){
	if(msg != ""){
		layer.msg(fontCssStart + msg + fontCssEnd,{time:2000});
	}
	msg="";
}



</script>
</head>
<body>
<!--[if lte IE 7]>
<style type="text/css">
#errorie {position: fixed; top: 0; z-index: 100000; height: 30px; background: #FCF8E3;}
#errorie div {width: 900px; margin: 0 auto; line-height: 30px; color: orange; font-size: 14px; text-align: center;}
#errorie div a {color: #459f79;font-size: 14px;}
#errorie div a:hover {text-decoration: underline;}
</style>
<div id="errorie"><div>您还在使用老掉牙的IE，请升级您的浏览器到 IE8以上版本 <a target="_blank" href="http://windows.microsoft.com/zh-cn/internet-explorer/ie-8-worldwide-languages">点击升级</a>&nbsp;&nbsp;强烈建议您更改换浏览器：<a href="http://down.tech.sina.com.cn/content/40975.html" target="_blank">谷歌 Chrome</a></div></div>
<![endif]-->
<div class="container">
    <div class="main_box">
        <form action="${request.contextPath}/sys/login" id="login_form" method="post">
            <input type="hidden" value="" id="j_randomKey" />
            <input type="hidden" name="jfinal_token" value="" />
            <p class="text-center logo"><h1 class="threed">智能医疗管理平台</h1></p>
            <div class="login_msg text-center"><font color="red"></font></div>
            <div class="form-group">
                <div class="input-group">
                    <span class="input-group-addon" id="sizing-addon-user"><span class="glyphicon glyphicon-user"></span></span>
                    <input type="text" class="form-control"  id="username" name="username"  placeholder="登录账号" aria-describedby="sizing-addon-user">
                </div>
            </div>
            <div class="form-group">
                <div class="input-group">
                    <span class="input-group-addon" id="sizing-addon-password"><span class="glyphicon glyphicon-lock"></span></span>
                    <input type="password" class="form-control"  id="password" name="password"  placeholder="登录密码" aria-describedby="sizing-addon-password">
                </div>
            </div>
            <div class="form-group">
                <div class="input-group">
                    <span class="input-group-addon" id="sizing-addon-password"><span class="glyphicon glyphicon-exclamation-sign"></span></span>
                    <input type="text" class="form-control"  id="captcha"  style="width:200px" name="captcha" placeholder="验证码" aria-describedby="sizing-addon-password">
                    <span class="input-group-addon code" id="basic-addon-code">
                    <img src="captcha.jpg" id="imgId"  style="width: 130px;height: 34px;"alt="点击更换" title="点击更换" onclick="javascript:this.src='captcha.jpg?t=' + new Date().getTime();" />
                    </span>
                </div>
            </div>
            <div class="form-group">
                <div class="checkbox">
                    <label for="j_remember" class="m"><input id="remember" type="checkbox" value="true">&nbsp;记住登陆账号!</label>
                </div>
            </div>
            <div class="text-center">
                <button type="button" id="login_ok" class="btn btn-primary btn-lg">&nbsp;登&nbsp;录&nbsp;</button>&nbsp;&nbsp;&nbsp;&nbsp;
                <button type="reset" class="btn btn-default btn-lg">&nbsp;重&nbsp;置&nbsp;</button>
            </div>
            <div class="text-center">
                <hr>
                2014 - 2016 <a href="login.html">春光无限工作室</a>
            </div>
        </form>
    </div>
</div>
</body>
</html>